package com.atguigu.study.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName:Knife4jConfig
 * Package: com.atguigu.study.config
 * Description:
 *
 * @Author Makabaka
 * @Create 2024/9/19 20:54
 * @Version 1.0
 */
@Configuration
public class Knife4jConfig {

    @Bean
    public OpenAPI openAPI(){
//        作者名称
        Contact contact = new Contact();
        contact.setName("玛卡巴卡");

        return new OpenAPI()
                .info(new Info()
//                        标题
                        .title("项目API")
//                        作者
                        .contact(contact)
//                        版本
                        .version("v1")
//                        简介
                        .description("项目接口文档")
                );
    }

    @Bean
    public GroupedOpenApi userAPI(){
        return GroupedOpenApi.builder()
                .group("user")
                .displayName("用户接口")
                .pathsToMatch("/user/**").build();
    }

    @Bean
    public GroupedOpenApi loginAPI(){
        return GroupedOpenApi.builder()
                .group("login")
                .displayName("登录接口")
                .pathsToMatch("/login/**").build();
    }
}
